/**
@author		Jong Min, Lee
@date		  10/01/2014
@breif		dicom frame class

copyright(c) Tae Young Soft. All right reserved. 2014
*/
#pragma once

#include "Taurus_Util/Macros.h"
#include "Taurus_DcmData/Defines.h"

//forward declarations
class IFrameInfo;
class CDcmInstance;

/**
@brief		dicom frame class
*/
class TAURUS_DCMDATA_EXPORT CDcmFrame
{
private:
  /**
  @brief		default constructor
  */
  CDcmFrame();

  DISALLOW_COPY_AND_ASSIGN(CDcmFrame);

public:
  friend class CDcmFrameProducer;

  /**
  @brief		destructor
  */
  ~CDcmFrame();

  /**
  @brief		get pointer to parent dcm instance
  @return		pointer to dcm instance if this has it, nullptr if not
  */
  inline CDcmInstance* getParent() const
  {
    return m_theParent;
  }

  /**
  @brief		set parent dcm instance
  @param		parent pointer to dcm instance to be parent
  */
  inline void setParent(CDcmInstance* parent)
  {
    m_theParent = parent;
  }

private:
  /**
  @brief		initialize dcm frame to default
  */
  void init();

  /**
  @brief		destroy dcm frame. this method should only be used in destructor
  */
  void destroy();

private:
  //parent dicom instance
  CDcmInstance* m_theParent;
};

/**
@brief		dcm frame producer
*/
class TAURUS_DCMDATA_EXPORT CDcmFrameProducer
{
public:
  /**
  @brief		create dcm frame by using frame information
  @param	  frameInfo frame information
  @param    parent pointer to dcm instance to be parent
  @param    outFrame variable in which referene to new dcm frame is stored
  @return		ERROR_SUCCESS if succeeds, an error code otherwise
  */
  static DWORD produce(IFrameInfo& frameInfo,
                       CDcmInstance* parent,
                       CDcmFrame*& outFrame);
};
